<?php
/**
 * @filename SimpleTest.php
 * @author LD King
 * @encoding UTF-8
 * @date 2008-9-5 | 下午08:04:22
 * @package Example
 * @subpackage 
 * @usage 测试适配器
 * @note 
 * @copyright Copyright (c) 2007 - 2008 LD (http://mifunny.info)
 * @version $Id: $
 */

include_once 'TurkeyAdapter.php';
include_once 'WildTurkey.php';

/**
 * 首先创建一只鸭子和一只火鸡
 */
$duck = new MallardDuck();
$turkey = new WildTurkey();

/**
 * 建一个火鸡适配器，将火鸡包装到其中，看上去似乎是只鸭
 */
$turkeyadapter = new TurkeyAdapter($turkey);

/**
 * 3.测试火鸡
 */
echo "<br />This is TurKey says: ";
$turkey->gobble();
$turkey->fly();

/**
 * 4.测试鸭子
 */
echo "<br />That is Duck says: ";
$duck->display();
$duck->perfromQuack();
$duck->perfromFly();

/**
 * 5.最后测试适配器
 */
echo "<br />The Last: TurKeyAdapter: ";
testDuck($turkeyadapter);

function testDuck(Duck $adapter) {
	$adapter->perfromQuack();
	$adapter->perfromFly();
}

?>